URLfetch

@command syntax: @URLfetch <url> , <return string> [ , <return error boolean>] [ , <post data> ]

This command requires a file called "ajax.php"to be included with the Javascript deployment, this file is available on request from XpertRule.

For posting data with the @URLfetch you would probably use all 4 parameters; the first parameter to indicate the target server page, the second parameter to allow you to capture a return from your server page such as 'success' or 'failure' in processing the posted data, the third parameter to indicate that the target server was reached, the fourth parameter to contain the data to be posted usually in the format 'object1=value1&object2=value2'.

For example reading a web page:

@URLfetch 'http://www.xpertrule.com',ret_str,ret_err

An example of communicating with a PHP page via the HTTP GET method:


@Dim target_URL:S, server_result:S, server_connected:S
@Assign target_URL = 'http://myserver.com/mygetdata.php?name=' & xrName & '&age=' & xrAge
@URLfetch target_URL,server_result,server_connected

An example of communicating with a PHP page via the HTTP POST method:


@Dim target_URL:S, server_result:S, server_connected:S, data_to_post:S
@Assign target_URL = 'http://myserver.com/mypostdata.php'
@Assign data_to_post = 'name=' & xrName & '&age=' & xrAge
@URLfetch target_URL,server_result,server_connected,data_to_post